package io.ouka.jvm.hotspot.selfread;

import com.alibaba.fastjson.JSONObject;
import io.ouka.jvm.hotspot.selfread.domain.*;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author Ouka
 */
public class InstanceKlass {
    private int magic;
    private int mainVersion;
    private int secondVersion;
    private ConstantPool constantPool;
    private int accessFLag;
    private int className;
    private int parentClassName;
    private int interfaceNums;

    private List<InterfaceInfo> interfaceInfos;

    private int fieldNums;
    private List<FieldInfo> fields = new ArrayList<>();

    private int methodLength;
    private MethodInfo[] methods;
    private AttributeInfo attributeInfo;

    @Override
    public String toString() {
        return "InstanceKlass{" +
                "magic=" + magic +
                ", mainVersion=" + mainVersion +
                ", secondVersion=" + secondVersion +
                ", constantPool=" + constantPool +
                ", accessFLag=" + accessFLag +
                ", className=" + className +
                ", parentClassName=" + parentClassName +
                ", interfaceNums=" + interfaceNums +
                ", interfaceInfos=" + interfaceInfos +
                ", fieldNums=" + fieldNums +
                ", fields=" + fields +
                ", methodLength=" + methodLength +
                ", methods=" + Arrays.toString(methods) +
                ", attributeInfo=" + attributeInfo +
                '}';
    }

    public AttributeInfo getAttributeInfo() {
        return attributeInfo;
    }

    public void setAttributeInfo(AttributeInfo attributeInfo) {
        this.attributeInfo = attributeInfo;
    }

    public int getMethodLength() {
        return methodLength;
    }

    public void setMethodLength(int methodLength) {
        this.methodLength = methodLength;
    }

    public MethodInfo[] getMethods() {
        return methods;
    }

    public void setMethods(MethodInfo[] methods) {
        this.methods = methods;
    }

    public int getFieldNums() {
        return fieldNums;
    }

    public void setFieldNums(int fieldNums) {
        this.fieldNums = fieldNums;
    }

    public List<FieldInfo> getFields() {
        return fields;
    }

    public void setFields(List<FieldInfo> fields) {
        this.fields = fields;
    }

    public List<InterfaceInfo> getInterfaceInfos() {
        return interfaceInfos;
    }

    public void setInterfaceInfos(List<InterfaceInfo> interfaceInfos) {
        this.interfaceInfos = interfaceInfos;
    }

    public int getInterfaceNums() {
        return interfaceNums;
    }

    public void setInterfaceNums(int interfaceNums) {
        this.interfaceNums = interfaceNums;
    }

    public int getParentClassName() {
        return parentClassName;
    }

    public void setParentClassName(int parentClassName) {
        this.parentClassName = parentClassName;
    }

    public int getClassName() {
        return className;
    }

    public void setClassName(int className) {
        this.className = className;
    }

    public int getSecondVersion() {
        return secondVersion;
    }

    public ConstantPool getConstantPool() {
        return constantPool;
    }

    public void setConstantPool(ConstantPool constantPool) {
        this.constantPool = constantPool;
    }

    public int getAccessFLag() {
        return accessFLag;
    }

    public void setAccessFLag(int accessFLag) {
        this.accessFLag = accessFLag;
    }

    public void setSecondVersion(int secondVersion) {
        this.secondVersion = secondVersion;
    }

    public int getMainVersion() {
        return mainVersion;
    }

    public void setMainVersion(int mainVersion) {
        this.mainVersion = mainVersion;
    }

    public int getMagic() {
        return magic;
    }

    public void setMagic(int magic) {
        this.magic = magic;
    }

}
